package com.analysis.exception;

/**
 * 百度千帆AppBuilder异常类
 * 用于处理AppBuilder API调用过程中的异常
 */
public class AppBuilderException extends Exception {
    
    private static final long serialVersionUID = 1L;
    
    /**
     * 错误码
     */
    private String code;
    
    /**
     * 请求ID
     */
    private String requestId;
    
    public AppBuilderException(String message) {
        super(message);
    }
    
    public AppBuilderException(String message, Throwable cause) {
        super(message, cause);
    }
    
    public AppBuilderException(String code, String message) {
        super(message);
        this.code = code;
    }
    
    public AppBuilderException(String code, String message, String requestId) {
        super(message);
        this.code = code;
        this.requestId = requestId;
    }
    
    public AppBuilderException(String code, String message, String requestId, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.requestId = requestId;
    }
    
    public String getCode() {
        return code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }
    
    public String getRequestId() {
        return requestId;
    }
    
    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }
    
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("AppBuilderException{");
        sb.append("code='").append(code).append('\'');
        sb.append(", requestId='").append(requestId).append('\'');
        sb.append(", message='").append(getMessage()).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
